<?php
/**
 * Created by PhpStorm.
 * User: Alan
 * Date: 2018\8\2 0002
 * Time: 13:49
 */

namespace app\api\model;


class Banner extends BaseModel
{
    protected $hidden = ['update_time','delete_time'];
    public function items()
    {
        return $this->hasMany('BannerItem','banner_id','id');
    }
    /**
     * @param $id
     * @return $this
     */
    public static function getBannerByID($id)
    {

        $banner = self::with(['items','items.img'])->find($id);

        return $banner;
    }
}